package rpg.engine.model;

import java.util.ArrayList;
import java.util.List;

import rpg.client.model.ActorInfo;
import rpg.engine.client.GameObjectInfo;
import rpg.util.Objects;

public class World {
	public static class Builder {
		public Builder()  {
			super();
		}
		
		public World build()  {
			return new World(this);
		}

		private String startStoryID = "";
		public void startStoryID(String s) {
			startStoryID = s;
		}

		private List<Story> stories = new ArrayList<Story>();
		public Builder story(Story story) {
			Objects.requireNonNull(story, "World.Builder.story");
			stories.add(story);
			return this;
		}

		private List<GameMap> maps = new ArrayList<GameMap>();
		public Builder gameMap(GameMap map) {
			maps.add(Objects.requireNonNull(map, "World.Builder.gameMap"));
			return this;
		}
		
		private List<ActorInfo> npcs = new ArrayList<ActorInfo>();
		public Builder npc(ActorInfo a)  {
			npcs.add(a);
			return this;
		}
		
		private List<GameObjectInfo> objects = new ArrayList<GameObjectInfo>();
		public Builder gameObject(GameObjectInfo o)  {
			objects.add(o);
			return this;
		}
	}
	
	private World(Builder b)  {
		super();
		startStoryID = b.startStoryID;
		stories.addAll(b.stories);
		maps.addAll(b.maps);
		npcs.addAll(b.npcs);
		objects.addAll(b.objects);
	}

	private final List<GameObjectInfo> objects = new ArrayList<GameObjectInfo>();
	public List<GameObjectInfo> getObjects()  {
		return objects;
	}
	
	private final List<ActorInfo> npcs = new ArrayList<ActorInfo>();
	public List<ActorInfo> getNpcs()  {
		return npcs;
	}
	
	private final String startStoryID;
	public String getStartStoryID() {
		return startStoryID;
	}

	private final List<Story> stories = new ArrayList<Story>();
	public List<Story> getStories() {
		return stories;
	}
	
	private final List<GameMap> maps = new ArrayList<GameMap>();
	public List<GameMap> getMaps() {
		return maps;
	}
}
